﻿using System;
using Iot.Shared.Helper;

namespace Iot.TimingDatabase.Models;

/// <summary>
///     属性名称可以和 数据库字段名称不一致 数据库字段名称由该属性指定
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="type"></param>
[AttributeUsage(AttributeTargets.Property)]
public class EnumColumnAttribute<T>(T type) : EnumColumnAttribute(type.GetDisplayName()) where T : Enum;

[AttributeUsage(AttributeTargets.Property)]
public class EnumColumnAttribute(string name) : Attribute
{
    public string Name { get; } = name;
}